<?php
namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repos\BillboardRepo;
use App\Models\Category;
use App\Services\RedisService;
use App\Http\Requests\ApiRequest;

class BillboardController extends Controller
{
    public function index(Request $request)
    {
    	$rs['status'] = false;
        $where = [];
        if($request->category_id) {
            $where['category_id'] = $request->category_id;
        }
        $list = BillboardRepo::get($where);
    	if($list) {
    		$rs['status'] = true;
    		$rs['data']['points']   = $list;
    		return response()->json($rs);
    	}
    	return response()->json($rs);
    }

   

    public function show(ApiRequest $reuqest)
    {
        $rs['status'] = false;
        
        $data = BillboardRepo::find(['id'=>$reuqest->id]);
        if($data) {
            $rs['status'] = true;           
            $rs['data'] = $data;           
            return response()->json($rs);
        }
        $rs['msg'] = '获取数据失败';
        return response()->json($rs);
        
    }
}
